home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.06 Jun 95 / Apple Events in PowerPlant / Powering Up Code / SCModelProperty.h < prev    next >
Encoding:
Text File  |  1995-04-04  |  1.4 KB  |  55 lines  |  [TEXT/MMCC]

  1. // ===========================================================================
  2. // SCModelProperty.h -- a model property that automatically handles undo
  3. // 
  4. // ===========================================================================
  5. // © 1994 James Kaput, SimCalc Project
  6.  
  7. #pragma once
  8.  
  9. #include "LSemanticAction.h"
  10.  
  11. class     SCModelProperty : public LModelProperty {
  12.  
  13.     public:
  14.         SCModelProperty(DescType                inPropertyID,
  15.                     LModelObject            *inSuperModel);
  16.         ~SCModelProperty();
  17.                                         
  18.     protected:
  19.         //override
  20.         virtual void    HandleSetData(const AppleEvent    &inAppleEvent,
  21.                                 AppleEvent            &outAEReply);
  22. };
  23.  
  24. struct    SPropDesc {
  25.     DescType    id;
  26.     Str63        name;
  27. };
  28.  
  29. #define ALIGN_WORD if (stream.GetMarker() & 0x01) stream.SetMarker(1, streamFrom_Marker);
  30.  
  31.  
  32. class    SCSetPropertyAction : public LSemanticAction {
  33.     public:
  34.                     SCSetPropertyAction(LModelObject    *inObject,
  35.                                     DescType        inPropID,
  36.                                     const AppleEvent     &inAE);
  37.         virtual        ~SCSetPropertyAction();
  38.  
  39.         virtual void RedoSelf();
  40.         virtual void UndoSelf();
  41.         virtual void GetDescriptor(Str63 outDescription);
  42.         
  43.         // utilities for describing a property based on the 'aete'
  44.         static void            InitPropDescriptors();
  45.         static Boolean        DescribeProperty(DescType inPropID, Str63 outDescriptor);
  46.     
  47.     private:
  48.         LModelObject            *mObject;
  49.         StAEDescriptor            mNewData,
  50.                             mOldData;
  51.         DescType                mPropID;
  52.         
  53.         static    LDynamicArray    *sPropDescArray;    // descriptors of properties
  54.         
  55. };